import type { OrderLogisticResult } from '@/types/order'
import { http } from '@/utils/http'

// 支付
// 获取微信支付参数
// GET
// /pay/wxPay/miniPay

export const getPayWxPayMinPayAPI = (data: { orderId: string }) => {
  return http<WechatMiniprogram.RequestPaymentOption>({
    method: 'GET',
    url: '/pay/wxPay/miniPay',
    data,
  })
}

// 支付
// 模拟支付-内测版
// GET
// /pay/mock

export const getPayMockAPI = (data: { orderId: string }) => {
  return http({
    method: 'GET',
    url: '/pay/mock',
    data,
  })
}

// 会员中心-订单管理
// 模拟发货-内测版
// 开发中
// GET
// /member/order/consignment/{id}

export const getMemberOrderConsignmentIdAPI = (id: string) => {
  return http({
    method: 'GET',
    url: `/member/order/consignment/${id}`,
  })
}

// 会员中心-订单管理
// 确认收货
// 开发中
// PUT
// /member/order/{id}/receipt

export const putMemberOrderReceiptIdAPI = (id: string) => {
  return http({
    method: 'PUT',
    url: `/member/order/${id}/receipt`,
  })
}

// 会员中心-订单管理
// 获取订单物流
// 开发中
// GET
// /member/order/{id}/logistics

export const getMemberOrderLogisticsIdAPI = (id: string) => {
  return http<OrderLogisticResult>({
    method: 'GET',
    url: `/member/order/${id}/logistics`,
  })
}

// 会员中心-订单管理
// 删除订单
// 开发中
// DELETE
// /member/order

export const deleteMemberOrderAPI = (data: { ids: string[] }) => {
  return http({
    method: 'DELETE',
    url: '/member/order',
    data,
  })
}
